<template>
    <!-- 修改资料 -->
    <div>
        <!-- 内容主题区域 -->
        <el-form label-width="75px" :model="form" label-position="right" ref="formRef" :rules="formRules" disabled>
            <el-row>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                    <el-form-item label="模板标识" prop="number">
                        <el-input style="width:70%" v-model="form.number"></el-input>&nbsp;
                    </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                    <el-form-item label="模板名称" prop="name">
                        <el-input v-model="form.name"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                    <el-form-item label="功能模块">

                        <el-input v-model="form.metaModuleName"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                    <el-form-item label="报表文件名">
                        <el-switch v-model="form.reportFileName"></el-switch>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                    <el-form-item label="附件">
                        <span class="link-type" @click="downloadFile">{{ form.fileName }}</span>
                    </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
                    <el-form-item label="状态" prop="status">
                        <el-switch v-model="form.status"></el-switch>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-form-item label="备注" prop="remark">
                <el-input v-model="form.remark" type="textarea"></el-input>
            </el-form-item>

            <sc-title title="表字段列表"></sc-title>
            <el-scrollbar height="400px">
                <sc-form-table v-model="dataList" disabled placeholder="暂无数据">
                    <template #tableContent>
                        <el-table-column prop="number" label="数据集标识">
                        </el-table-column>
                        <el-table-column prop="name" label="名称">
                        </el-table-column>
                        <el-table-column prop="datasetTypeName" label="字段类型">
                        </el-table-column>
                    </template>
                </sc-form-table>
            </el-scrollbar>
        </el-form>
        <div class="button-position">
            <el-button @click="updateVisible">退 出</el-button>
        </div>
    </div>
</template>

<script setup>
import { reactive, ref, onMounted } from 'vue';
import { ElNotification } from 'element-plus';
import { Check, Close } from '@element-plus/icons-vue';
import Api from '@/api/model/meta'
import sysApi from '@/api/model/system.js'
const emit = defineEmits(['updatetable'])
// 添加用户数据的对象
const form = ref({});
const dataList = ref([])
const formRef = ref()
const props = defineProps({
    paramsData: {
        type: Object,
        defalut: {}
    }
})
onMounted(() => {
    getInit()
})

const downloadFile = async () => {
    let params = {
        saveAsFileName: form.value.fileName,
        downloadFileName: form.value.excelTemplateFile
    }
    let res = await sysApi.uploadfile.post(params)
}
const getInit = async () => {
    let formRes = await Api.pageTemplate.detail.post(props.paramsData)
    console.log(formRes)
    if (formRes.code == 200) {
        form.value = formRes.data
        dataList.value = formRes.dataList
    }
}

const updateVisible = (val) => {
    emit('updatetable')
}




</script>

<style lang="less" scoped>
:deep(.el-card__body) {
    padding-top: 5px;
    padding-bottom: 0px;
}

.borderNone {
    :deep(.el-input__wrapper) {
        box-shadow: 0 0 0 0px var(--el-input-border-color, var(--el-border-color)) inset;
        cursor: default;
        background-color: transparent; //背景颜色透明
        border-bottom: 1px solid #999;
        border-radius: 0;

        .el-input__inner {
            cursor: default !important;
        }
    }

    :deep(.el-textarea__inner) {
        box-shadow: 0 0 0 0px var(--el-input-border-color, var(--el-border-color)) inset;
        cursor: default;
        background-color: transparent; //背景颜色透明
        border-bottom: 1px solid #999;
        border-radius: 0;
    }
}

.link-type,
.link-type:focus {
    color: #337ab7;
    cursor: pointer;
}

.link-type:focus:hover,
.link-type:hover {
    color: #20a0ff
}
</style>
